﻿using System;

namespace MySqlQueryToolkit
{
    public interface IProfileQueryReporter
    {
        ProfileQueryResult Report(string query);
    }

    public class ProfileQueryReporter : IProfileQueryReporter
    {
        private readonly IProfileQueryRepository _profileQueryRepository;

        public ProfileQueryReporter(IProfileQueryRepository profileQueryRepository)
        {
            _profileQueryRepository = profileQueryRepository;
        }

        public ProfileQueryResult Report(string query)
        {
            if (string.IsNullOrEmpty(query))
            {
                throw new ArgumentException();
            }

            return _profileQueryRepository.GetEntitiesFromDatabase(query);
        }
    }
}
